package com.zrrd.mcl.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zrrd.mcl.model.product.BaseCategory1;
import com.zrrd.mcl.model.product.BaseCategory2;
import com.zrrd.mcl.model.product.BaseCategory3;
import com.zrrd.mcl.product.mapper.BaseCategory1Mapper;
import com.zrrd.mcl.product.mapper.BaseCategory2Mapper;
import com.zrrd.mcl.product.mapper.BaseCategory3Mapper;
import com.zrrd.mcl.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl extends ServiceImpl<BaseCategory1Mapper, BaseCategory1> implements CategoryService {

    @Autowired
    private BaseCategory2Mapper baseCategory2Mapper;
    @Autowired
    private BaseCategory3Mapper baseCategory3Mapper;

    @Override
    public List<BaseCategory2> getCategory2List(Long category1Id) {
        return baseCategory2Mapper.selectList(new QueryWrapper<BaseCategory2>()
                .eq("category1_id",category1Id));
    }

    @Override
    public List<BaseCategory3> getCategory3List(Long category2Id) {
        return baseCategory3Mapper.selectList(new QueryWrapper<BaseCategory3>()
                .eq("category2_id",category2Id));
    }
}
